// 导入react和react-dom
import React from 'react';
import ReactDom from 'react-dom/client';
import './yangshi.css';

const list = [
  { id: 1, name: '刘德华', content: '给我一杯忘情水' },
  { id: 2, name: '五月天', content: '不打扰，是我的温柔' },
  { id: 3, name: '毛不易', content: '像我这样优秀的人' },
];

const divNode = (
  <>
    <ul>
      {list.map((item) => {
        return (
          <li key={item.id} className='liClass'>
            <h3 className="nameClass">评论人：{item.name}</h3>
            <p className="contentClass">评论内容：{item.content}</p>
          </li>
        );
      })}
    </ul>
  </>
);

// 18版本以上新出的挂载方法
const root = ReactDom.createRoot(document.getElementById('root'));
root.render(divNode);
